VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DAOClienteNatural"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private mvarConnection As utilConexion 'local copy

Public Property Set Connection(ByVal vdata As utilConexion)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Connection = vData
    Set mvarConnection = vdata
End Property


'---------------------------------------------------------------------------------------
' Procedure : getLista
' DateTime  : 23/06/2008 18:02
' Author    : fdamiani
' Purpose   :
'---------------------------------------------------------------------------------------
'
Public Function getLista(bean As bClienteNatural) As Collection
'On Error GoTo hnderr
Dim sql As String
Dim rst As New Recordset
Dim list As New Collection
Dim record As bClienteNatural

sql = "SELECT ncodigo ,    ntipdocumento ,    snumdocumento , scodbarra,    snombres ,    sapellidos ,    stelefono ,"
sql = sql + " sdireccion ,    semail ,    nestado ,    sestado , stipdocumento ,    bfecnacimiento ,    dfecnacimiento "
sql = sql + "FROM proc_cliente_select('" + CStr(bean.sNombres) + "','" + bean.sApellidos + "','" + bean.sCodBarra + "');"

rst.Open sql, mvarConnection.Connection, adOpenForwardOnly

While Not rst.EOF
    Set record = New bClienteNatural
    If Not IsNull(rst.Fields("scodbarra")) Then record.sCodBarra = Trim(rst.Fields("scodbarra").value)
    If Not IsNull(rst.Fields("ncodigo")) Then record.nCodigo = rst.Fields("ncodigo").value
    If Not IsNull(rst.Fields("snombres")) Then record.sNombres = rst.Fields("snombres").value
    If Not IsNull(rst.Fields("sapellidos")) Then record.sApellidos = rst.Fields("sapellidos").value
    If Not IsNull(rst.Fields("nestado")) Then record.bTipoDocumento.nCodigo = rst.Fields("ntipdocumento").value
    If Not IsNull(rst.Fields("ntipdocumento")) Then record.bTipoDocumento.nCodigo = rst.Fields("ntipdocumento").value
    If Not IsNull(rst.Fields("stipdocumento")) Then record.bTipoDocumento.sDescripcion = rst.Fields("stipdocumento").value
    If Not IsNull(rst.Fields("sNumDocumento")) Then record.sNumDocumento = rst.Fields("sNumDocumento").value
    If Not IsNull(rst.Fields("semail")) Then record.sEmail = rst.Fields("semail").value
    If Not IsNull(rst.Fields("bfecnacimiento")) Then record.bFecNacimiento = rst.Fields("bfecnacimiento").value
    If record.bFecNacimiento Then If Not IsNull(rst.Fields("dfecnacimiento")) Then record.dFecNacimiento = rst.Fields("dfecnacimiento").value
    If Not IsNull(rst.Fields("nestado")) Then record.bEstado.nCodigo = rst.Fields("nestado").value
    If Not IsNull(rst.Fields("sestado")) Then record.bEstado.sDescripcion = rst.Fields("sestado").value
    If Not IsNull(rst.Fields("sdireccion")) Then record.sDireccion = rst.Fields("sdireccion").value
    If Not IsNull(rst.Fields("stelefono")) Then record.sTelefono = rst.Fields("stelefono").value
    
    rst.MoveNext
    list.Add record
Wend
Set getLista = list

hnderr:
If Err.Number = 0 Then Exit Function
cloneError Err
End Function





